#!/bin/bash

# 自动获取第一个WiFi网卡接口
INTERFACE=$(nmcli device | awk '$2=="wifi"{print $1}' | head -1)
SSID="Mingserve_Sensor"
PASSWORD="Ming@Serve"

# 创建热点
nmcli device wifi hotspot ifname "$INTERFACE" ssid "$SSID" password "$PASSWORD"

## 创建热点并返回JSON结果
#if nmcli device wifi hotspot ifname "$INTERFACE" ssid "$SSID" password "$PASSWORD" >/dev/null 2>&1; then
#  echo '{"success":true}'
#else
#  echo '{"success":false, "error":"Failed to create hotspot"}'
#fi